
function weTree(oEl){
if(!oEl){alert("调用方法: weTree(this);");return false;}
if(fmTop.cols == "200,*"){fmTop.cols = "0,*";oEl.innerText="菜单开启";}
else{fmTop.cols = "200,*";oEl.innerText="菜单关闭";}
return true;
}
function weHelp(oEl){
if(fmMain.weHelp)return fmMain.weHelp(oEl);
alert("帮助!");
return true;
}
function weTreeFlush(oTree){return fmTree.cLoaf.flushTree(oTree);}
function weTreeView(oTree){return fmTree.cLoaf.viewTree(oTree);}
function weShut(){
fmQury.zDocId=0;closeFm("fmBar1");
fmList.zDocId=0;closeFm("fmBar2");weCLS();
fmTool.location="/AppDoc/EHSmng/HomeObj/fmTool.htm";
return true;
}
function weCLS(){
fmMain.document.body.innerHTML="<div id=msg class=msgOrg></div>";
fmMain.zDocId=0;
return true;
}
function getDocId(oFm){
if(!oFm){alert("调用方法: getDocId(oFm);");return 0;}
if(oFm.zDocId)return oFm.zDocId;
return 0;
}

function CWaitLoad(){
this.mvCallBack=null;	//after loaded,call this
this.miIdx=0;	//current checking frame index
}
CWaitLoad.prototype.waitLoad=function(vCallBack){
if(this.mvCallBack)return alert("上次作业没有完成");
this.mvCallBack=vCallBack;this.miIdx=frames.length-1;
return setTimeout(waitLoaded,300);;
}
CWaitLoad.prototype.waitLoaded=function(){
for(;this.miIdx>=0;this.miIdx--){
if(typeof(frames[this.miIdx].document)=="unknown"){alert("装载 frames["+this.miIdx+"] 失败");}
else if(frames[this.miIdx].document.readyState!="complete"){return setTimeout(waitLoaded,500);}
}
var vCallBack=this.mvCallBack;this.mvCallBack=null;
return vCallBack();
}
var cWaitLoad=new CWaitLoad();
function waitLoaded(){return cWaitLoad.waitLoaded();}
function waitLoad(fn){
if(!fn)return weMsg("没有提供回调函数",false);
if(typeof(fn)=="function")return cWaitLoad.waitLoad(fn);
return weMsg("回调函数参数不是一个 function:"+typeof(fn),false);
}

function openFm(zName,iRows){
if(!frames[zName])return false;
if(!frames[zName].weMenu)return false;
return frames[zName].weMenu(true,iRows);
}
function shutFm(zName){
if(!frames[zName])return false;
if(!frames[zName].weMenu)return false;
return frames[zName].weMenu(false);
}
function closeFm(zName){return shutFm(zName);}

function openDiv(oDiv,zTxt){
var oPare=oDiv.parentElement.children;
for(var i=0;i<oPare.length;i++){
	var oEl=oPare[i];
	if(oEl.tagName!="DIV")continue;
	if(oEl!=oDiv){oEl.className="divOrg";continue;}
	if(openDiv.arguments.length==2)oEl.innerHTML=zTxt;
	oEl.className="divSel";
}
switch(oDiv.document.parentWindow.name){
case "fmQury":return openFm("fmBar1");
case "fmList":return openFm("fmBar2");
default:return true;
}}
function shutDiv(oDiv){
var oPare=oDiv.parentElement.children;
for(var i=0;i<oPare.length;i++){
	var oEl=oPare[i];
	if(oEl.tagName!="DIV")continue;
	oEl.className="divOrg";
}
return true;
}
function getDiv(oDiv){
var oPare=oDiv.parentElement.children;
for(var i=oPare.length;--i>=0;){
	var oEl=oPare[i];
	if(oEl.tagName!="DIV")continue;
	if(oEl.className=="divSel")return oEl;
}
return null;
}